home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / mini / XFree86-XInside < prev    next >
Text File  |  1997-10-07  |  15KB  |  387 lines

  1.   Linux XFree-to-Xinside mini-HOWTO
  2.   by Marco Melgazzi, marco@techie.com
  3.   version 1.3 / 1997 September
  4.  
  5.   How to convert an XFree86 modeline into an XInside/XiGraphics one
  6.  
  7.   1.  Introduction
  8.  
  9.   During the spring of 1996 I've seen a lot of posts in comp.os.linux.x
  10.   asking how to convert video modes between XFree86 and one of its
  11.   commercial alternatives: XInside ( now named XiGraphics, note anyway
  12.   that in this document I'll use the old product name, since I will
  13.   mainly refer to that version )
  14.  
  15.   I had evaluated before the product and had this evaluation version
  16.   still floating on my hard disk: since I like problem solving, I've
  17.   decided to give it a try and, after a couple of hours of fiddling and
  18.   calculating, I came up with a supposedly informative article that was
  19.   promptly posted.
  20.  
  21.   The discussions about how to convert suddendly vanished and I received
  22.   1 (one) mail thanking me for the article so, since maybe somebody else
  23.   could need this information in the future, I decided to transform that
  24.   post in the mini-HOWTO you are reading.
  25.  
  26.   Let me state something first: I do NOT work for XInside and I only had
  27.   access to the evaluation 1.2 version for Linux. I know that nowadays (
  28.   May 97 ) AccelX has reached revision 3.1, but I do think that the
  29.   information included in this document, if not verbatim, is still
  30.   applicable.
  31.  
  32.   Due to the fact that this HOWTO has been written with the help of a
  33.   pretty old Xinside version, it may well happen that some of the
  34.   information contained here is not completely accurate: as you will
  35.   read later, thanks to the birth of XFree 3.2, I haven't bought this
  36.   commercial server, so if you have, and if you notice any incorrect
  37.   information here please take the time to email me.
  38.  
  39.   Notice anyway that fiddling with monitor timings can be hazardous and,
  40.   for this reason, I absolutely make no guarantees. If it works for you
  41.   , fine, if you blow up your computer I shall not be held responsible
  42.   for it.
  43.  
  44.   As you may have noticed from may name, I'm not a native speaker of
  45.   English so you will probably find some errors here and there, I
  46.   apologize for them and I ask you to please avoid flooding my mailbox
  47.   with language-related flames. Thanks !
  48.  
  49.   2.  Why should I need it ?
  50.  
  51.   I think that the Xinside policy of not giving you an utility to tweak
  52.   your video modes ( like xvidtune ) and/or to import your existing
  53.   XFree ones in the evaluation ( and AFAIK commercial ) version is
  54.   incomprehensible.  I've spent about three hours putting this together
  55.   ( hint: I've compared the VESA 1024x768@70Hz entry in the two formats
  56.   ( and I'm nearly an electronic engineer ;-)) while an Xinside
  57.   programmer could have written a comparable article in a fraction of
  58.   this time...
  59.  
  60.   I haven't downloaded any evaluation version from 1.3 onwards and I
  61.   really hope they have fixed this. Well, if they have, this mini-HOWTO
  62.   could be considered useless but, alas, if you read it you will learn
  63.   something more about how everything works...
  64.   3.  Let's go
  65.  
  66.   Let's suppose that you have your oh-so-tweaked XFree86 mode and you
  67.   want to evaluate Xinside in the same conditions: follow the steps
  68.   described below and you should be able to do it; we will use my
  69.   default video mode as a real-life example and I will explain what you
  70.   will have to do to convert it.
  71.  
  72.   An Xfree86 entry looks like this:
  73.  
  74.        Modeline "blahblah" DOTCLK  A B C D  a b c d
  75.  
  76.   Every one of the A-D and a-d numbers has a meaning: if you want you
  77.   can search for it in the 'The Hitchhiker's Guide to X386/XFree86 Video
  78.   Timing' ( /usr/lib/X11/doc/VideoModes.doc ) but you don't need to know
  79.   the theory behind all this to perform a succesful conversion...
  80.  
  81.   My modeline in /usr/lib/X11/XF86Config is:
  82.  
  83.        Modeline "1168x876" 105  1168 1256 1544 1640  876 877 891 900
  84.                             |     |    |    |    |    |   |   |   |
  85.                          DOT_CLK  A    B    C    D    a   b   c   d
  86.  
  87.   In Xinside, you have to add an entry in the Xtimings file, which
  88.   should be located in etc/ ( from now on we suppose you are in the top
  89.   Xaccel directory that should be something like
  90.   /usr/X11/lib/X11/AcceleratedX )
  91.  
  92.   !    Somewhere in the file, put here the name you want
  93.  
  94.   [PREADJUSTED_TIMING]
  95.       PreadjustedTimingName = "1168x876 @ 72Hz";
  96.  
  97.   !
  98.   !    These four are obvious
  99.   !
  100.       HorPixel          = 1168;         // pixels
  101.       VerPixel          = 876;          // lines
  102.       PixelWidthRatio   = 4;
  103.       PixelHeightRatio  = 3;
  104.  
  105.   !
  106.   !   hsync: DOT_CLK / D * 1000 [KHz]
  107.   !
  108.   !   hsync = 105 / 1640 * 1000 = 64.024 KHz
  109.   !
  110.   !   vsync: ( 1 / (( D / DOT_CLK ) * d) ) * 1,000,000 [Hz]
  111.   !
  112.   !   vsync: ( 1 / (( 1640 / 105 ) * 900) ) * 1,000,000
  113.   !           ( 1 / 14057.1428571 ) * 1,000,000 = 71.138 Hz
  114.   !
  115.  
  116.       HorFrequency      = 64.180;        // kHz
  117.       VerFrequency      = 71.138;        // Hz
  118.  
  119.   !   Obvious
  120.  
  121.       ScanType          = NONINTERLACED;
  122.  
  123.   !
  124.   !   Put here the +/-hsync +/-vsync XFree86 options
  125.   !
  126.       HorSyncPolarity   = POSITIVE;
  127.       VerSyncPolarity   = POSITIVE;
  128.  
  129.   !   Shouldn't change
  130.  
  131.       CharacterWidth    = 8;             // pixels
  132.  
  133.   !   DOT_CLK here
  134.  
  135.       PixelClock        = 105.000;       // MHz
  136.   !
  137.   !
  138.   !   horizontal timings section: [usec]
  139.   !
  140.       HorTotalTime  = D / DOT_CLK                  = 15.619;
  141.       HorAddrTime   = A / DOT_CLK                  = 11.124;
  142.       HorBlankStart = A / DOT_CLK                  = 11.124;
  143.       HorBlankTime  = HorTotalTime - HorBlankStart =  4.495;
  144.       HorSyncStart  = B / DOT_CLK                  = 11.962;
  145.       HorSyncTime   = C / DOT_CLK - HorSyncStart   =  2.743;
  146.  
  147.    !
  148.    !  vertical timings section:    [msec]
  149.    !
  150.  
  151.       VerTotalTime  = ( HorTotalTime * d ) / 1000  = 14.057;
  152.       VerAddrTime   = ( HorTotalTime * a ) / 1000  = 13.682;
  153.       VerBlankStart = ( HorTotalTime * a ) / 1000  = 13.682;
  154.       VerBlankTime  = VerTotalTime - VerBlankStart =  0.375;
  155.       VerSyncStart  = ( HorTotalTime * b ) / 1000  = 13.698;
  156.       VerSyncTime   = ( HorTotalTime * ( c - b ) ) / 1000
  157.                                                    = 0.219
  158.    ! Finished !
  159.  
  160.   Now you have to put this newly created mode in the files shown below
  161.   in the appropriate place.
  162.  
  163.   4.  Fixing up things
  164.  
  165.   In the excerpts shown below the -> sign tells you what was modified:
  166.   do NOT include it in your files!
  167.  
  168.   Monitor entry ( mine is monitors/mfreq/mfreq64.vda)
  169.  
  170.            [ESTABLISHED_TIMINGS]
  171.                "640x480 @ 60Hz",
  172.                "640x480 @ 72Hz",
  173.                "640x480 @ 75Hz",
  174.                "800x600 @ 56Hz",
  175.                "800x600 @ 60Hz",
  176.                "800x600 @ 72Hz",
  177.                "800x600 @ 75Hz",
  178.                "1024x768 Interlaced",
  179.                "1024x768 @ 60Hz",
  180.                "1024x768 @ 70Hz",
  181.                "1024x768 @ 75Hz",
  182.            "1152x900 Interlaced",
  183.                "1152x900 @ 60Hz",
  184.                "1152x900 @ 67Hz",
  185.        ->      "1168x876 @ 72Hz",
  186.                "1280x1024 Interlaced",
  187.                "1280x1024 @ 60Hz",
  188.            "1600x1200 Interlaced";
  189.  
  190.   Board info file ( mine is boards/s3/764-2.xqa , I wonder why they have
  191.   nearly all the Hercules boards but not MINE: Terminator 64/Dram )
  192.  
  193.   [VISUAL]
  194.       BitsPerPixel   = 8;
  195.       MemoryModel    = Packed;
  196.       ColorModel     = Indexed;
  197.       BitsRGB        = 6;
  198.       NumberOfColors = 256;
  199.  
  200.       [RESOLUTIONS]
  201.       640x480,
  202.       800x600,
  203.       1024x768,
  204.   ->  1168x876,
  205.       1152x900,
  206.       1280x1024
  207.  
  208.       [DESKTOPS]
  209.       640x480,
  210.       800x600,
  211.       1024x768,
  212.       1152x900,
  213.   ->  1168x876,
  214.       1280x1024,
  215.       1600x1200
  216.  
  217.   If the dot clock is low enough ( NOT in this case for my board ) you
  218.   can put the entry even in the 16bpp and 32bpp sec- tions.
  219.  
  220.   The /etc/Xaccel.ini will look something like this
  221.  
  222.        --------------------------------------------------------------
  223.            Board   = "s3/764-2.xqa";
  224.            Monitor = "mfreq/mfreq64.vda";
  225.            Depth   = 8;
  226.        ->  Desktop = 1168x876;
  227.  
  228.            [RESOLUTIONS]
  229.        ->      1168x876,
  230.                1024x768;
  231.  
  232.   The actual Xinside mode entry in etc/Xtimings
  233.  
  234.   --------------------------------------------------------------
  235.   [PREADJUSTED_TIMING]
  236.       PreadjustedTimingName = "1168x876 @ 72Hz";
  237.  
  238.       HorPixel          = 1168;          // pixels
  239.       VerPixel          = 876;           // lines
  240.       PixelWidthRatio   = 4;
  241.       PixelHeightRatio  = 3;
  242.       HorFrequency      = 64.024;        // kHz
  243.       VerFrequency      = 71.138;        // Hz
  244.       ScanType          = NONINTERLACED;
  245.       HorSyncPolarity   = POSITIVE;
  246.       VerSyncPolarity   = POSITIVE;
  247.       CharacterWidth    = 8;             // pixels
  248.       PixelClock        = 105.000;       // MHz
  249.       HorTotalTime      = 15.619;        // (usec) =  205 chars
  250.       HorAddrTime       = 11.124;        // (usec) =  146 chars
  251.       HorBlankStart     = 11.124;        // (usec) =  146 chars
  252.       HorBlankTime      =  4.495;        // (usec) =   59 chars
  253.       HorSyncStart      = 11.962;        // (usec) =  157 chars
  254.       HorSyncTime       =  2.743;        // (usec) =   36 chars
  255.       VerTotalTime      = 14.057;        // (msec) =  900 lines
  256.       VerAddrTime       = 13.682;        // (msec) =  876 lines
  257.       VerBlankStart     = 13.682;        // (msec) =  876 lines
  258.       VerBlankTime      =  0.375;        // (msec) =   24 lines
  259.       VerSyncStart      = 13.698;        // (msec) =  877 lines
  260.       VerSyncTime       =  0.219;        // (msec) =   14 lines
  261.  
  262.   You can check your conversion by running the vgaset program with no
  263.   parameters while running the Xinside server: it will output an XFree-
  264.   like line and, if everything went OK, this line will be equal to the
  265.   line you started from ( except if b and c are equal, I haven't been
  266.   able to reproduce this situation in Xinside: the best case was c=b+1
  267.   ).
  268.  
  269.   5.  The end...
  270.  
  271.   That's all folks ! I hope this will be useful to you. I don't think
  272.   I'll buy the XiGraphics server in the near future for one simple
  273.   reason: the release of XFree86 3.2 solved all of the text speed
  274.   problems I was having on my humble Trio 64 video board ;)
  275.  
  276.   It seems anyway that the XiGraphics server supports a much wider array
  277.   of chipsets and video boards than XFree, so it may well happen that
  278.   the commercial 'alternative' is the only viable one for you. If this
  279.   is the case, and you bought the XiGraphics server, I would really like
  280.   to hear from you to know if the information presented here has been
  281.   useful to you, or if you found it too complex or whatever.
  282.  
  283.   6.  Automating the process
  284.  
  285.   This small script automates most of the work. Be very careful with the
  286.   ScanType and with the two Polarity lines: the script do not set them
  287.   and, if you are too lazy to correct them, the risks of blowing up your
  288.   monitor increase quite a lot.
  289.  
  290.   Notice that I don't know if the 'Doublescan' flag has meaning in
  291.   XInside: if you try to convert a low-res doublescan mode BE CAREFUL,
  292.   you can easily kill your monitor since the refresh rate that you get
  293.   is doubled ( in fact my 400x300@72Hz became a 400x300@144Hz !).
  294.  
  295.        #!/bin/sh
  296.        ##########################################################################
  297.        # XF2XInside
  298.        #
  299.        # This script converts modelines from XF86Config format to XInside
  300.        # format as needed for the etc/Xtiming file.
  301.        #
  302.        # This is a quick hack, so don't expect much error checking (not to
  303.        # speak of anything like user friendlyness).
  304.        #
  305.        # If you call it without arguments it should tell you what to do.
  306.        #
  307.        #                               ( July 1996, hcz@tazlwurm.bb.bawue.de)
  308.        #
  309.        # Btw: New modes created as described in the HOWTO work, but don't
  310.        # show up in Xsetup's menu. Anybody who knows why?
  311.        #
  312.        ##########################################################################
  313.        #----------------------------------------------- Here we go:
  314.        # Change this if your modeline file lives somewhere else:
  315.        XF=/usr/X11/lib/X11/XF86Config
  316.        if [ $# -ne 1 ] ; then
  317.          echo "usage: ${0##*/} <mode>"
  318.          echo " example: ${0##*/} 1024x764"
  319.          echo -e " function: converts $XF modeline entry into\n Xinside Format (stdout)"
  320.          exit 1
  321.        fi
  322.        egrep -i "^[\t ]*modeline.+\"$1\""  /usr/X11/lib/X11/XF86Config |
  323.        gawk '
  324.        NF < 11  { print "! invalid Modeline:\n! " $0 "\n!"; next }
  325.        {
  326.          print "//", $0  ":"
  327.          name = $2
  328.          DOT_CLK = $3;
  329.          A = $4;
  330.          B = $5;
  331.          C = $6;
  332.          D = $7;
  333.          a = $8;
  334.          b = $9;
  335.          c = $10;
  336.          d = $11;
  337.          VerFrequency =  1000000 / ((D / DOT_CLK) * d)
  338.          print "[PREADJUSTED_TIMING]"
  339.          printf "  PreadjustedTimingName = \"%dx%d @ %.0dHz\";\n", A, a, VerFrequency
  340.          print "  HorPixel\t\t= " A ";"
  341.          print "  VerPixel\t\t= " a ";"
  342.          print "  PixelWidthRatio\t= 4;\n  PixelHeightRatio\t= 3;"
  343.          print "  HorFrequency\t\t= " DOT_CLK / D * 1000 ";\t// kHz"
  344.          print "  VerFrequency\t\t= " VerFrequency  ";\t// Hz"
  345.          print "  ScanType\t\t= NONINTERLACED;\t\t// *CHECK*"
  346.          print "  HorSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
  347.          print "  VerSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
  348.          print "  CharacterWidth\t= 8;"
  349.          print "  PixelClock\t\t= " DOT_CLK ";"
  350.          HorTotalTime = D / DOT_CLK
  351.          print "  HorTotalTime\t\t= " HorTotalTime ";"
  352.          print "  HorAddrTime \t\t= " A / DOT_CLK ";"
  353.          print "  HorBlankStart\t\t= " A / DOT_CLK ";"
  354.          print "  HorBlankTime\t\t= " D / DOT_CLK - A / DOT_CLK ";"
  355.          print "  HorSyncStart\t\t= " B / DOT_CLK ";"
  356.          print "  HorSyncTime\t\t= " C / DOT_CLK - B / DOT_CLK ";"
  357.          VerTotalTime  = ( HorTotalTime * d ) / 1000
  358.          print "  VerTotalTime\t\t= " VerTotalTime ";"
  359.          print "  VerAddrTime\t\t= " ( HorTotalTime * a ) / 1000 ";"
  360.          VerBlankStart = ( HorTotalTime * a ) / 1000
  361.     print "  VerBlankStart\t\t= " VerBlankStart ";"
  362.     print "  VerBlankTime\t\t= " VerTotalTime - VerBlankStart ";"
  363.     print "  VerSyncStart\t\t= " ( HorTotalTime * b ) / 1000 ";"
  364.     print "  VerSyncTime\t\t= " ( HorTotalTime * ( c - b ) ) / 1000
  365.     print ""
  366.   }'
  367.  
  368.   7.  Thanks to
  369.  
  370.   ╖  Heike Claudia Zimmerer hcz@tazlwurm.bb.bawue.de for pointing out a
  371.      small inconsistency and for sending me a script that automates most
  372.      of the work.
  373.  
  374.   ╖  Bartosz Maruszewski B.Maruszewski@zsmeie.torun.pl for translating
  375.      this mini HOWTO in Polish and for pointing out a small typo.
  376.  
  377.   8.  Copyright/legalese
  378.  
  379.   (c)opyright 1996-7 by Marco Melgazzi (marco@techie.com) - the GPL (Gnu
  380.   Public License) applies. To obtain a copy of the GPL write to the Free
  381.   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  382.  
  383.   Trademarks are owned by their owners. There is no warranty on the
  384.   accuracy and/or the usefulness of the information given in this
  385.   document.
  386.  
  387.